package com.ruoyi.web.controller.qynhgl;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.qynygl.domain.TbQynyglSssjcx;
import com.ruoyi.qynygl.service.ITbQynyglSssjcxService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 实时数据查询Controller
 * 
 * @author XT
 * @date 2023-11-10
 */
@RestController
@RequestMapping("/qynygl/sssjcx")
public class TbQynyglSssjcxController extends BaseController
{
    @Autowired
    private ITbQynyglSssjcxService tbQynyglSssjcxService;

    /**
     * 查询实时数据查询列表
     */
    @PreAuthorize("@ss.hasPermi('qynygl:sssjcx:list')")
    @GetMapping("/list")
    public TableDataInfo list(TbQynyglSssjcx tbQynyglSssjcx)
    {
        startPage();
        List<TbQynyglSssjcx> list = tbQynyglSssjcxService.selectTbQynyglSssjcxList(tbQynyglSssjcx);
        return getDataTable(list);
    }

    /**
     * 导出实时数据查询列表
     */
    @PreAuthorize("@ss.hasPermi('qynygl:sssjcx:export')")
    @Log(title = "实时数据查询", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbQynyglSssjcx tbQynyglSssjcx)
    {
        List<TbQynyglSssjcx> list = tbQynyglSssjcxService.selectTbQynyglSssjcxList(tbQynyglSssjcx);
        ExcelUtil<TbQynyglSssjcx> util = new ExcelUtil<TbQynyglSssjcx>(TbQynyglSssjcx.class);
        util.exportExcel(response, list, "实时数据查询数据");
    }

    /**
     * 获取实时数据查询详细信息
     */
    @PreAuthorize("@ss.hasPermi('qynygl:sssjcx:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tbQynyglSssjcxService.selectTbQynyglSssjcxById(id));
    }

    /**
     * 新增实时数据查询
     */
    @PreAuthorize("@ss.hasPermi('qynygl:sssjcx:add')")
    @Log(title = "实时数据查询", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbQynyglSssjcx tbQynyglSssjcx)
    {
        return toAjax(tbQynyglSssjcxService.insertTbQynyglSssjcx(tbQynyglSssjcx));
    }

    /**
     * 修改实时数据查询
     */
    @PreAuthorize("@ss.hasPermi('qynygl:sssjcx:edit')")
    @Log(title = "实时数据查询", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbQynyglSssjcx tbQynyglSssjcx)
    {
        return toAjax(tbQynyglSssjcxService.updateTbQynyglSssjcx(tbQynyglSssjcx));
    }

    /**
     * 删除实时数据查询
     */
    @PreAuthorize("@ss.hasPermi('qynygl:sssjcx:remove')")
    @Log(title = "实时数据查询", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tbQynyglSssjcxService.deleteTbQynyglSssjcxByIds(ids));
    }
}
